﻿using System;
using System.Data;
using System.Runtime.Serialization;
using System.Configuration;
using System.Linq;
using System.Xml.Linq;
using System.IO;
using System.Runtime.Serialization.Json;
using System.Text;

namespace MyBBS.Controllers
{
    [DataContract]
    public class Result : JsonResult
    {
        [DataMember]
        public bool isSuccessful { get; set; }

        [DataMember]
        public bool isException { get; set; }

        [DataMember]
        public string errorMessage { get; set; }



        public override string ToJson()
        {
            using (MemoryStream ms = new MemoryStream())
            {
                var s = new DataContractJsonSerializer(GetType());
                s.WriteObject(ms, this);
                ms.Seek(0, SeekOrigin.Begin);
                return Encoding.Default.GetString(ms.ToArray());
            }

        }
    }
}
